//
//  Emoticon.swift
//  Emoticon
//
//  Created by 刘俊 on 15/10/27.
//  Copyright © 2015年 刘俊. All rights reserved.
//

import UIKit

/// 表情包模型
class Emoticon: NSObject {

    ///发送给服务器的表情的表情集字符串
    var chs: String?
    ///保存在本地的表情图片
    var png: String?
    ///表情的字符编码
    var code: String? {
        didSet {
            emoji = code?.emoji
        }
    }
    ///完整路径
    var pngPath: String {
        if png == nil {
            return ""
        }
        return NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png!
    }
    /// 将表情字符编码转化为unicode
    var emoji: String?
    ///是否是删除按钮
    var isRemove: Bool = false 
    init(isRemove: Bool) {
        self.isRemove = isRemove
    }
    ///是否添加空白
    var isEmpty = false
    init(isEmpty: Bool) {
        self.isEmpty = isEmpty
    }
    init(dict: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    override var description: String {
        let keys = ["chs","png","code"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
